<template>
  <div class="public_main">
    <div class="crumbs">
      <el-breadcrumb separator="/">
        <el-breadcrumb-item>{{$t('sidebar.operator')}}</el-breadcrumb-item>
        <el-breadcrumb-item>{{$t('newcrumbs.crumbsThr')}}</el-breadcrumb-item>
        <el-breadcrumb-item>{{$t('new.no97')}}</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="con">
        <el-form :model="addForm" size="small" class="form" ref="addForm" label-width="100px">
            <el-form-item :label="$t('merchantList.no8')">
                <span>{{addForm.partnerId}}</span>
            </el-form-item>
            <el-form-item :label="$t('merchantList.no1')">
                <span>{{addForm.partnerName}}</span>
            </el-form-item>
            <!-- <el-form-item :label="$t('public.appName')">
                <span></span>
            </el-form-item> -->
            <el-form-item :label="$t('new.no98')">
                <el-input type="text" v-model="addForm.customerServicePhone1"></el-input>
            </el-form-item>
            <!-- <el-form-item :label="$t('new.no98')+2">
                <el-input type="text" v-model="addForm.customerServicePhone2"></el-input>
            </el-form-item> -->
            <el-form-item :label="$t('new.no100')">
                <el-time-select
                    v-model="addForm.workTimeStart"
                    :picker-options="{
                    start: '08:30',
                    step: '00:30',
                    end: '22:00'
                    }">
                </el-time-select>
            </el-form-item>
            <el-form-item :label="$t('new.no101')">
                <el-time-select
                    v-model="addForm.workTimeEnd"
                    :picker-options="{
                    start: '08:30',
                    step: '00:30',
                    end: '22:00',
                    minTime: addForm.workTimeStart
                    }">
                </el-time-select>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" v-if="$store.state.common.permiss.serviceconfig.includes('edit')" @click="submitForm('addForm')">{{$t('public.no41')}}</el-button>
             </el-form-item>
        </el-form>
    </div>
  </div>
</template>
<script>
export default {
    data(){
        return{
          addForm:{
             partnerCustomerServiceId:'',
             id:'',
             partnerName:'',
             customerServicePhone1:'',
             customerServicePhone2:'',
             workTimeStart:'',
             workTimeEnd:'' 
          }  
        }
    },
    methods: {
        submitForm (formName) {// 修改添加提交操作
            let option = {
                param: {
                ...this.addForm
                }       
            }
            this.$refs[formName].validate((valid) => {
                if (valid) {
                this.$axios.post(this.$action.customer_serviceUpdate, option).then(res => {
                    if (res.code == 200) {
                    this.$globalMsg.success(res.message);
                    }else{
                    this.$globalMsg.error(res.message)
                    }
                })
                }
            })
        },
        getData() {
            let option={
                param:{}
            }
            this.$axios.post(this.$action.customer_service,option).then(res => {
                if (res.code == 200) {
                   this.addForm=res.data;
                   this.addForm.id=res.data.partnerCustomerServiceId;
                } else {
                    this.$globalMsg.error(res.message);
                }
            });
        }
    },
    mounted(){
        this.getData();
    }
}
</script>
<style lang="scss" scoped>
.con{
    background-color: #fff;
    padding:20px;
}
.form{
    width:400px;
}

</style>